using System;
using System.Collections.Generic;
using System.Text;

using Northwind.Domain.Entities;
using NUnit.Framework;

namespace Northwind.Domain.Tests.Custom
{
    [TestFixture]
    public class CategoryFixture
    {
        [Test]
        public void VerifyPicture()
        {
            Category category = Category.Broker.GetByID(1);
            Assert.AreEqual("Beverages", category.CategoryName);
            Assert.IsNotNull(category.Picture,"Northwind..Categories['Beverages'] should have a picture.");
        }

        [Test]
        public void VerifyNullValues()
        {
            string categoryName = "<category-name>";

            Category category = new Category();
            category.CategoryName = categoryName;
            category.Save();

            Category secondCategory = Category.Broker.GetByID(category.CategoryID);
            Assert.AreEqual(categoryName, secondCategory.CategoryName, "Category name should be valid.");
            Assert.IsNull(secondCategory.Description,"Category description should be null.");
            Assert.IsNull(secondCategory.Picture, "Category picture should be null.");

            secondCategory.Delete();

            Category thirdCategory = Category.Broker.GetByID(category.CategoryID);
            Assert.IsNull(thirdCategory, "Category should have been deleted.");
        }
    }
}
